home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 495 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: stc06.ctd.ornl.gov!mbk
  2. From: mbk@jt3ws1.etd.ornl.gov (Kennel)
  3. Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel
  4. Subject: Re: Hungarian notation
  5. Followup-To: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel
  6. Date: 4 Jan 1996 20:58:36 GMT
  7. Organization: Oak Ridge National Lab, Oak Ridge, TN
  8. Message-ID: <4chf1s$rg7@stc06.ctd.ornl.gov>
  9. References: <cmanDK7x13.5KM@netcom.com> <verec-2712952049000001@ppp30.micronet.fr> <30E39BC0.3BAE@zeta.org.au>
  10. Reply-To: kennel@msr.epm.ornl.gov
  11. NNTP-Posting-Host: jt3ws1.etd.ornl.gov
  12. X-Newsreader: TIN [version 1.2 PL2]
  13.  
  14. > Jean-Francois Brouillet wrote:
  15. > > Completely agree that scope is much more important than type encoding.
  16. > > An additional convention, borrowed from PowerPlant is:
  17. > > > > void
  18. > > myFunc(
  19. > >     UInt32      inLongArgument,
  20. > >     UInt16 &    outShortArgument,
  21. > >     char *      ioCommandOnInputResultOnOutput);
  22. > > [snip]
  23.  
  24. > Jean-Francois, I quite like this... reminds me of Pascal, but it adds value
  25. > to the variable name.
  26.  
  27. > I only got one bite with the following, last time I posted it here...
  28. > What about using things built into the language to tell the reader what
  29. > things are used for ? Not only can the resultant code be read easily by
  30. > anyone who has a good working knowledge of the language, but it can help
  31. > enforce such things as input-only, etc.
  32.  
  33. > For function parameters which are input only, pass by value or by const 
  34. > reference. Pass by const pointer in the case of an array (passing by
  35. > reference implies singular, by pointer implies multiple).
  36.  
  37. Or, of course, one could do the obvious thing and decorate arguments with
  38. that simply awful convention of "in" "out" and "inout" keywords like
  39. Ada and Sather. 
  40.  
  41. > Parameters used to return values can be specified as non-const reference
  42. > or pointer - again, reference implies singular, pointer implies multiple
  43. > (i.e. an array).
  44.  
  45. Now look carefully at this C/C++ induced confusion of "intent of parameters"
  46. "constancy" "pointer vs reference semantics" "pointers vs arrays". 
  47.  
  48. mbk
  49.